﻿<!DOCTYPE html>
<html lang="en-us">
<head>
    <meta charset="utf-8">
    <title>数据提取记录</title>
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">

    <!-- #CSS Links -->
    <!-- Basic Styles -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/font-awesome.css">

    <!-- SmartAdmin Styles : Caution! DO NOT change the order -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-production-plugins.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-production.css">
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-skins.css">

    <!-- SmartAdmin RTL Support -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/smartadmin-rtl.css">

    <!-- Demo purpose only: goes with demo.js, you can delete this css when designing your own WebApp -->
    <link rel="stylesheet" type="text/css" media="screen" href="css/demo.css">

    <!-- #FAVICONS -->
    <link rel="shortcut icon" href="img/favicon/favicon.ico" type="image/x-icon">
    <link rel="icon" href="img/favicon/favicon.ico" type="image/x-icon">

    <!-- #GOOGLE FONT -->
    <link rel="stylesheet" href="css/open-sans.css" type="text/css">

    <!-- #APP SCREEN / ICONS -->
    <link rel="apple-touch-icon" href="img/splash/sptouch-icon-iphone.png">
    <link rel="apple-touch-icon" sizes="76x76" href="img/splash/touch-icon-ipad.png">
    <link rel="apple-touch-icon" sizes="120x120" href="img/splash/touch-icon-iphone-retina.png">
    <link rel="apple-touch-icon" sizes="152x152" href="img/splash/touch-icon-ipad-retina.png">

    <!-- iOS web-app metas : hides Safari UI Components and Changes Status Bar Appearance -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <!-- Startup image for web apps -->
    <link rel="apple-touch-startup-image" href="img/splash/ipad-landscape.png"
          media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:landscape)">
    <link rel="apple-touch-startup-image" href="img/splash/ipad-portrait.png"
          media="screen and (min-device-width: 481px) and (max-device-width: 1024px) and (orientation:portrait)">
    <link rel="apple-touch-startup-image" href="img/splash/iphone.png" media="screen and (max-device-width: 320px)">
    <link href="appcss/Common.css" rel="stylesheet" />


</head>
<body class="desktop-detected minified">

    <!-- #MAIN PANEL -->
    <div id="main" role="main">

        <!-- RIBBON -->
        <div id="ribbon">

            <span class="ribbon-button-alignment">
                <span class="btn btn-ribbon"><i class="fa fa-home"></i></span>
            </span>

            <!-- breadcrumb -->
            <ol class="breadcrumb">
                <li><a href="javascript:window.history.back();">数据提取记录-Step1</a></li>
                <li>数据提取记录-Step2</li>
            </ol>
            <!-- end breadcrumb -->

        </div>
        <!-- END RIBBON -->
        <!-- MAIN CONTENT -->
        <div id="content">
            <div class="row hidden">
                <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
                    <h2 class="page-title txt-color-blueDark">
                        <i class="fa fa-table fa-fw "></i>
                        主页

                        <span>
                            数据提取记录
                        </span>
                    </h2>
                </div>
            </div>

            <!-- widget grid -->
            <section id="widget-grid" class="">

                <!-- row -->
                <div class="row" style="margin-top: 8px;">

                    <!-- NEW WIDGET START -->
                    <article class="col-xs-12 col-sm-12 col-md-12 col-lg-12">

                        <div class="jarviswidget jarviswidget-sortable" id="wid-id-0">
                            <header>
                                <span class="widget-icon"><i class="fa fa-table"></i></span>
                                <h2>数据提取记录列表</h2>
                            </header>
                            <div>
                                <!-- widget edit box -->
                                <div class="jarviswidget-editbox">
                                    <div class="dt-toolbar">
                                        <div class="col-xs-2 ">
                                            <input type="text" class="form-control" placeholder="开始时间" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" id="BeginDate" />
                                        </div>
                                        <div class="col-xs-2 ">
                                            <input type="text" class="form-control" placeholder="结束时间" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" id="EndDate" />
                                        </div>
                                        <div class="col-sm-8">
                                            <div class="dataTables_length">
                                                <label style="float: left;">
                                                    <input type="button" class="form-control" onclick="Search();" value="检索" />
                                                </label>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!-- end widget edit box -->
                                <!-- widget content -->
                                <div class="widget-body">
                                    <div class="table-responsive">
                                        <table class="table table-hover table-bordered smart-form " id="Table-Recordes">
                                            <thead>
                                                <tr>
                                                    <th>外部程序</th>
                                                    <th>服务类型</th>
                                                    <th>数据源</th>
                                                    <th>数据总量</th>
                                                    <th>提取数量</th>
                                                    <th>退回数量</th>
                                                    <th>最后执行时间</th>
                                                    <th>操作</th>
                                                </tr>
                                            </thead>
                                            <tbody></tbody>
                                        </table>

                                    </div>

                                </div>
                                <!-- end widget content -->

                            </div>
                            <!-- end widget div -->

                        </div>

                        <!-- end widget -->

                    </article>
                    <!-- WIDGET END -->

                </div>

                <!-- end row -->

            </section>
            <!-- end widget grid -->
        </div>
        <!-- END MAIN CONTENT -->
    </div>

    <!-- END #MAIN CONTENT -->
    <!--================================================== -->
    <!-- PACE LOADER - turn this on if you want ajax loading to show (caution: uses lots of memory on iDevices)
    <script data-pace-options='{ "restartOnRequestAfter": true }' src="js/plugin/pace/pace.min.js"></script>-->
    <!-- #PLUGINS -->
    <!-- Link to Google CDN's jQuery + jQueryUI; fall back to local -->


    <script src="js/libs/jquery-2.1.1.min.js"></script>
    <script src="js/libs/jquery-ui-1.10.3.min.js"></script>
    <!-- BOOTSTRAP JS -->
    <script src="js/bootstrap/bootstrap.min.js"></script>

    <!-- IMPORTANT: APP CONFIG -->
    <script src="js/app.config.js"></script>


    <!-- CUSTOM NOTIFICATION -->
    <script src="js/notification/SmartNotification.min.js"></script>

    <!-- JARVIS WIDGETS -->
    <script src="js/smartwidgets/jarvis.widget.min.js"></script>


    <!-- SPARKLINES -->
    <script src="js/plugin/sparkline/jquery.sparkline.min.js"></script>

    <!-- JQUERY MASKED INPUT -->
    <script src="js/plugin/masked-input/jquery.maskedinput.min.js"></script>


    <!-- JQUERY UI + Bootstrap Slider -->
    <script src="js/plugin/bootstrap-slider/bootstrap-slider.min.js"></script>

    <script src="js/plugin/datatables/jquery.dataTables.min.js"></script>
    <script src="js/plugin/datatables/dataTables.colVis.min.js"></script>
    <script src="js/plugin/datatables/dataTables.tableTools.min.js"></script>
    <script src="js/plugin/datatables/dataTables.bootstrap.min.js"></script>
    <script src="js/plugin/datatable-responsive/datatables.responsive.min.js"></script>
    <script src="appjs/Common.js"></script>
    <script src="appjs/Helper.js"></script>
    <script src="js/app.min.js"></script>
    <script src="js/plugin/My97DatePicker/WdatePicker.js"></script>
    <script>
        var draw = 0;
        var table;
        var appId = GetQueryString("appId");
        $(function () {
            var intData = function () {
                var d = new Date();
                var vYear = d.getFullYear();
                var vMon = d.getMonth() + 1;
                var vDay = d.getDate();
                var temp = (vMon - 1 < 10 ? "0" + (parseInt(vMon) - 1) : (parseInt(vMon) - 1));
                var begindata = vYear + "-" + (parseInt(temp) === 0 ? "01" : temp) + "-01";
                var enddata = "";
                if (parseInt(vMon) < 12) {
                    enddata = vYear + "-" + ((vMon + 1) < 10 ? ("0" + (parseInt(vMon) + 1)) : (parseInt(vMon) + 1)) + "-01";
                } else {
                    enddata = (parseInt(vYear) + 1) + "-" + "01" + "-01";
                }
                $("#BeginDate").val(begindata);
                $("#EndDate").val(enddata);
            }
            intData();
            Search();
        });

        var Search = function () {
            if (draw == 0) {
                initializationDataTableForMine();
            } else {
                table.fnDraw();
            }
        }
        var initializationDataTableForMine = function () {
            //初始化表格
            try {
                table = $('#Table-Recordes').dataTable({
                    "autoWidth": true,
                    "oLanguage": dataTableConfig,
                    "bLengthChange": false,
                    ordering: false,
                    bProcessing: true,
                    bStateSave: true,
                    serverSide: true,
                    searching: false,
                    aLengthMenu: [25],
                    "ajax": {
                        url: apiUrl,
                        "dataSrc": function (json) {
                            if (json.IsSccuess) {
                                var newjson = new Array();
                                for (var i = 0; i < json.Data.Items.length; i++) {
                                    var obj = json.Data.Items[i];
                                    var editstr = "";
                                    editstr += "<a href=\"javascript:void(0);\" onclick=\"LookDetails(this)\" data='" + JSON.stringify(json.Data.Items[i]);
                                    editstr += "'><i class=\"fa fa-hand-o-right\"></i>查看记录</a>";
                                    newjson.push({ "appname": obj.AppName, "dataservicename": obj.DataServiceText, "datasourcename": obj.DataSourceText, "extractedtime": obj.CreatedTime, "extractedcount": obj.ExtractedCount, "rejectedcount": obj.RejectedCount, "option": editstr, "datacount": obj.DataCount });
                                }
                                return newjson;
                            } else {
                                if (IsLogined(json.ErrorCode)) {
                                    alert("错误代码：" + json.ErrorCode + "，错误信息：" + json.Message);
                                }
                            }
                            return [];
                        },
                        "data": function (d) {
                            draw = d.draw;
                            return $.extend({}, { "sys:sno": "AppExtract" }, { "sys:act": "GetRecordList" }, { "AppId": appId }, { "BeginTime": $("#BeginDate").val() }, { "EndTime": $("#EndDate").val() }, { "draw": draw }, { "length": d.length }, { "Page": parseInt(d.start / d.length) });
                        }
                    },
                    columns: [
                        { data: 'appname' },
                        { data: 'dataservicename' },
                        { data: 'datasourcename' },
                        { data: 'datacount' },
                        { data: 'extractedcount' },
                        { data: 'rejectedcount' },
                        { data: 'extractedtime' },
                        { data: 'option' }
                    ]
                });
            } catch (e) {
                console.log(e);
            }
        }
        var LookDetails = function (obj) {
            var url = "DataExtractionRecordInfo.html?data=" + escape($(obj).attr("data"));
            window.location.href = url;
        }
    </script>
</body>
</html>
